﻿<%@ Page Language="C#" MasterPageFile="~/ExampleMaster.Master" AutoEventWireup="true"
    CodeBehind="PartitionedSelect.aspx.cs" Inherits="Web.Samples.PartitionedSelect"
    Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleZone" runat="server">
    Partitioned Select
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="IntroTextZone" runat="server">
    LINQ introduces two new functions Skip and Take which are very useful when supporting
    a paging system. These functions do not have query expression equilivalents, though
    I will still show how to use them in a Query Expression.
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="QueryExpressZone" runat="server">
    <pre class="code">            <span style="color: rgb(0,0,255)">var</span> query = (<span
        style="color: rgb(0,0,255)">from</span> sp <span style="color: rgb(0,0,255)">in</span> <span
            style="color: rgb(43,145,175)">StateProvince</span>.GetStateProvinces()
                         <span style="color: rgb(0,0,255)">select</span> sp.Name).Skip(20).Take(15);

            <span style="color: rgb(0,0,255)">foreach</span> (<span style="color: rgb(0,0,255)">string</span> s <span
                style="color: rgb(0,0,255)">in</span> query)
            {
                <span style="color: rgb(0,0,255)">this</span>.litQueryResults.Text += s + <span style="color: rgb(163,21,21)">"&lt;br
                    /&gt;\n"</span>;
            }</pre>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="QueryResultsZone" runat="server">
    <asp:Literal ID="litQueryResults" runat="server" />
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ImperativeZone" runat="server">
    <pre class="code">            <span style="color: rgb(0,0,255)">var</span> query = <span
        style="color: rgb(43,145,175)">StateProvince</span>.GetStateProvinces().Select(sp =&gt; sp.Name).Skip(20).Take(10);

            <span style="color: rgb(0,0,255)">foreach</span> (<span style="color: rgb(0,0,255)">string</span> s <span
                style="color: rgb(0,0,255)">in</span> query)
            {
                <span style="color: rgb(0,0,255)">this</span>.litImperativeResults.Text += s + <span
                    style="color: rgb(163,21,21)">"&lt;br /&gt;\n"</span>;
            }</pre>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="ImperativeResultsZone" runat="server">
    <asp:Literal ID="litImperativeResults" runat="server" />
</asp:Content>
